Top > How to import data > Importing through PowerShell > Sample cmdlet calls

Sample cmdlet calls

In the following samples, the template name is ‘psimport’.

 

      A basic call to the cmdlet, explicitly specifying the parameter names:

import-servicemanagerdata -name psimport -literalpath
"c:\Users\username\documents\test5.csv”

   A basic call to the cmdlet using positional call for template name:

import-servicemanagerdata psimport -literalpath
"c:\Users\username\documents\test3.csv"

   A call to the cmdlet with verbose messages turned on:

import-servicemanagerdata -verbose -name psimport -literalpath
"c:\Users\username\documents\test5.csv"

   A call to the cmdlet with user controlled error handling, where the user variable is ‘myerr’:

import-servicemanagerdata -verbose psimport -literalpath
"c:\Users\username\documents\test3.csv" -erroraction Inquire -errorvariable +myerr

   Piping the parameters in a file to the cmdlet:

Import-csv "C:\SqlQuery.csv" | import-servicemanagerdata -name sqlimport
-onerroraction skip